home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / programming / basic / mildred / mildred.lha / lha / DeResDemo.lha / DeResTest.ascii < prev    next >
Text File  |  1999-03-30  |  2KB  |  82 lines

  1.  
  2. WBStartup
  3. NoCli
  4.  
  5. DEFTYPE.l
  6.  
  7. .initgraphics
  8. MBitmap 1,320,240
  9. MBitmap 0,320,240
  10.  
  11. Mc2pWindow 0,320,240                ; Setup structures for c2p conversions.
  12.  
  13. InitBank 0,320*240,$10002           ; Get some free CHIP memory.
  14. CludgeBitMap 0,320,240,8,Bank(0)    ; And make it a planar bitmap.
  15. LoadBitMap 0,"DeResPic15.IFF",0      ; Get a pic
  16. MPlanar16ToBitmap 0,Bank(0),320,240,320,240 ; Make it chunky
  17.  
  18. Dim scrtaglst.TagItem(7)            ; All this stuff sets up our
  19. scrtaglst(0)\ti_Tag = #SA_Left      ; Taglist for the screen we
  20. scrtaglst(0)\ti_Data = 0          ; want. As you can see, it's
  21. scrtaglst(1)\ti_Tag = #SA_Depth     ; rather non-standard.
  22. scrtaglst(1)\ti_Data = 8            ; it doesn't have to be, it's
  23. scrtaglst(2)\ti_Tag = #SA_Width     ; just that this routine needs
  24. scrtaglst(2)\ti_Data = 320          ; a larger screen to avoid
  25. scrtaglst(3)\ti_Tag = #SA_Height    ; clipping.
  26. scrtaglst(3)\ti_Data = 240
  27. scrtaglst(4)\ti_Tag = #SA_BitMap
  28. scrtaglst(4)\ti_Data = Addr BitMap (0)
  29. scrtaglst(5)\ti_Tag = #SA_ShowTitle
  30. scrtaglst(5)\ti_Data = 0
  31. scrtaglst(6)\ti_Tag = #SA_Draggable
  32. scrtaglst(6)\ti_Data = 0
  33. scrtaglst(7)\ti_Tag = #TAG_END      ; The most important tag of them all.
  34.  
  35.  
  36. ScreenTags 0,"MildredDEMO",&scrtaglst(0) ; Open our intuition screen.
  37.  
  38. ShowPalette 0                       ; Attach our palette to the screen.
  39.  
  40. MUseBitmap 1                        ; Tell Mildred to use our main
  41.                                     ; chunky buffer (just in case)
  42. mag.q=1
  43. its.l=0
  44. magdirection.q=2.5 ; magnification adder
  45. SourceX.q=0
  46. SourceY.q=0
  47. OpWidth.w=320
  48. OpHeight.w=240
  49. DestX.w=0
  50. DestY.w=0
  51. ResetTimer
  52. Repeat                              ; Repeat our mainloop ....
  53.   If mag+magdirection>240 OR mag+magdirection<1 Then magdirection=-magdirection
  54.   mag+magdirection
  55.   SourceXAdder.q=mag/240
  56.   SourceYAdder.q=mag/240
  57.  
  58.   ;De-Res
  59.   MZoom SourceX,SourceY,SourceXAdder,SourceYAdder,DestX,DestY,OpWidth,OpHeight,True,0
  60.  
  61.   ;Scale
  62. ;  MZoom SourceX,SourceY,SourceXAdder,SourceYAdder,DestX,DestY,OpWidth,OpHeight,False,0
  63.  
  64.   Mc2p Bank(0)                      ; Convert our chunky buffer to
  65.   its+1
  66.  
  67. Until Joyb(0)<>0 OR Joyb(1)<>0 OR RawStatus($45)
  68. t=Timer
  69. t=Max(t,1)
  70. its=Max(its,1)
  71. a.q=50.0/(t/its)
  72. WbToScreen 1
  73. Window 2,16,16,400,60,0,"Test results",1,0
  74. WindowOutput 2
  75. NPrint a," frames per second"
  76. NPrint " "
  77. NPrint "Press mouse/joy button..."
  78. VWait 20
  79. Repeat
  80. Until Joyb(0)<>0 OR Joyb(1)<>0 OR RawStatus($45)
  81.  
  82.